<template>
    <el-dialog :title="titleMap[mode]" v-model="visible" :width="500" destroy-on-close @closed="$emit('closed')" align-center :close-on-click-modal="false">
		<el-form :model="form" :rules="rules" :disabled="mode == 'show'" ref="dialogForm" label-width="90" label-position="right">
            <el-form-item label="回单附件" prop="verification_voucher">
                <sc-upload-file v-model="form.verification_voucher">
                    <el-button type="primary" size="small">上传</el-button>
                </sc-upload-file>
            </el-form-item>
		</el-form>
		<template #footer>
			<el-button @click="visible = false">取 消</el-button>
		</template>
	</el-dialog>
</template>

<script>
export default {
	emits: ['success', 'closed'],
	data() {
		return {
			dialog: {
				client: false
			},
			mode: "add",
			titleMap: {
				add: '新增合同',
				edit: '核销凭证',
				show: '查看附件'
			},
			visible: false,
			isSaveing: false,
			//表单数据
			form: {
				id: "",
                verification_voucher:"",
			},
		}
	},
	mounted() {
	},
	methods: {
		//显示
		open(mode = 'add') {
			this.mode = mode;
			this.visible = true;
			return this
		},
		//表单注入数据
		async setData(data) {
            this.form.id = data.id
            this.form.verification_voucher = data.verification_voucher?data.verification_voucher:""
		},
	}
}
</script>

<style lang="scss">
.el-input-group__append{
    padding: 0 8px;
}
.SeletBox {
	width: 100%;
	display: flex;
	align-items: center;
}
.el-radio.el-radio--large{
    height: 0;
}
</style>
